package com.hsq.ndmall.wx.controller;

import cn.hutool.json.JSONUtil;
import com.hsq.ndmall.common.utils.R;
import com.hsq.ndmall.wx.service.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 黄四清
 * @version 1.0.0
 * @ClassName CatalogController.java
 * @Description TODO 分类
 * @createTime 2021年08月18日 18:58:00
 */
@RestController
@RequestMapping("/wx/catalog")
public class CatalogController {

    @Autowired
    private CatalogService catalogService;


    //  首页
    @GetMapping("/index")
    public R HomeIndex() {
        Map indexMap = catalogService.findIndexData();
        return R.ok().put("data", indexMap);
    }

    // 根据Id查询
    @GetMapping("/current")
    public R selectById(@RequestParam("id") Integer id) {

        Map indexMap =   catalogService.selectCurrentById(id);
        return R.ok().put("data",indexMap);
    }

    //
}
